#include <stdlib.h>
#include <iostream>
#include <fstream>
using namespace std;

int main(int argc, char **argv) {
	int i=0;
	int j=0;
	int n=7;
	int m=1;

	if(argc > 1)
		n=atoi(argv[1]);

	ofstream myfile;
	myfile.open ("world/empty.cfg");

	myfile << "driver (\n\tname \"stage\"\n\tplugin \"stageplugin\"\n\tprovides [\"simulation:0\"]\n\tworldfile \"empty.world\"\n)\n\n";

	for(i=0;i<n;i++)
		myfile << "driver (\n\tname \"stage\"\n\tprovides [\"laser:" << i << "\" \"position2d:" << i << "\"]\n\tmodel \"mapper" << i << "\"\n)\n\n";

	for(j=i;j<m+i;j++)
		myfile << "driver (\n\tname \"stage\"\n\tprovides [\":laser:" << j << "\" \":position2d:" << j << "\"]\n\tmodel \"firefighter" << j << "\"\n)\n\n";

	myfile.close();

	//ofstream myfile;
	myfile.open ("world/empty.world");

	myfile << "include \"map.inc\"\n#include \"mapper.inc\"\ninclude \"pioneer.inc\"\ninclude \"sick.inc\"\n\nwindow (\n\tsize [500.0 500.0]\n\tcenter [11.45 -11.45]\n\tscale 20\n\tshow_grid 0\n\tshow_clock 0\nshow_data 1\n)\n\n";

	myfile << "floorplan (\n\tname \"office\"\n\tsize [22.9 22.9 1]\n\tpose [11.45 -11.45 0 0]\n\tbitmap \"office.png\"\n)\n\n";


	for(i=0;i<n;i++)
		myfile << "pioneer2dx (\n\tname \"mapper" << i << "\"\n\tcolor \"blue\"\n\tpose [1 " << -1-2*i << " 0 0]\n\tsicklaser()\n)\n\n";

	for(j=i;j<m+i;j++)
		myfile << "pioneer2dx (\n\tname \"firefighter" << j << "\"\n\tcolor \"red\"\n\tpose [1 " << -1-2*j << " 0 0]\n\tsicklaser()\n)\n\n";

	myfile.close();
	return 0;
}


